package com.coco.group.controller;

import com.coco.common.annotation.IngoreResponseAdvice;
import com.coco.group.pojo.TbGroupBuyHelp;
import com.coco.group.service.GroupBuyHelpService;
import com.coco.group.vo.GroupHelpAndUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Package: com.coco.group.controller
 * @Author: 张dy
 * @Date: Created in 2021/7/29 下午 7:57
 * 团购参与用户
 */
@RestController
@RequestMapping("/group/help")
public class GroupBuyHelpController {

    @Autowired
    private GroupBuyHelpService groupBuyHelpService;


    /**
     * 查看当前团购的参与人员信息
     * @Author: 张dy
     * @Date: 2021/7/30
     * @Param:
     */
    @GetMapping("/findBuyHelp/{recordId}")
    public List<GroupHelpAndUser> findBuyHelp(@PathVariable("recordId")Long recordId){

        return groupBuyHelpService.findBuyHelp(recordId);
    }

    @PostMapping("/addHelp")
    @IngoreResponseAdvice
    public void addHelp(@RequestBody TbGroupBuyHelp groupBuyHelp){
        groupBuyHelpService.addGroupBuyHelp(groupBuyHelp);
    }
}
